Vue.prototype.$axios = axios
const api = axios.create({
    // set the base URL
})
api.defaults.transformRequest = [
    function (data, headers) {
        // set the headers
        return JSON.stringify(data);
    }
]
api.interceptors.request.use(
    config => {
        // if the token is stored in the browser
        // set it into the HTTP authorization key
        return config
    },
    error => {
        return Promise.reject(error)
    }
)
api.interceptors.response.use(
    response => {
        // handle the defferent HTTP statuese
    },
    error => {
        //TODO: handle the network error
    }
)
Vue.prototype.$api = api
export {axios, api}